**RAP replication
*Import Stata dataset for Study 2, "Covid_PID_RAP_2.dta"


*Gen treatment assignment
gen treatment=.
replace treatment=1 if TreatmentassignmentforDemocrats1==1
replace treatment=1 if TreatmentassignmentforPureIndepe==1
replace treatment=1 if TreatmentassignmentforRepublica1==1

replace treatment=2 if TreatmentassignmentforDemocrats0==1
replace treatment=2 if TreatmentassignmentforPureIndep1==1
replace treatment=2 if TreatmentassignmentforRepublica0==1

replace treatment=3 if TreatmentassignmentforDemocrats_==1
replace treatment=3 if TreatmentassignmentforPureIndep0==1
replace treatment=3 if TreatmentassignmentforRepublican==1

label define treatment 1 "Control" 2 "Partisan" 3 "Bipartisan"
label values treatment treatment


*gen pid indicators

gen democrat=0
replace democrat=1 if Q13==1 | Q21==1
gen independent=0
replace independent=1 if Q13==4 | Q21==3
gen republican=0
replace republican=1 if Q13==2 | Q21==2

gen pid=.
replace pid=1 if democrat==1
replace pid=2 if independent==1
replace pid=3 if republican==1
label define pid 1 "Democrat" 2 "Indepenent" 3 "Republican"
label values pid pid

*drop independent (N=38)
drop if pid==2

gen college=.
replace college=0 if Q25<5
replace college=1 if Q25>=5
label define college 0 "Less than college" 1 "College degree"
label values college college

gen age=2021-(1900+Q3)

gen income=Q27
replace income=. if Q27==15
replace income=7 if income==.

gen white=.
replace white=0 if Q5>1
replace white=1 if Q5==1
label define white 0 "non-white" 1 "white"
label values white white

gen female=.
replace female=0 if Q7==1
replace female=1 if Q7==2
label define female 0 "Male" 1 "Female"
label values female female

rename Q38 mandate
*higher values is disagree with college vaccine mandates

*Balance Test - testing for covariate balance across conditions
ologit mandate i.treatment  

mlogit treatment republican age white female college income if e(sample)
est store m1

*Balanced across conditions

sort treatment pid 

by treatment pid: sum mandate 
*Table 1

ologit mandate i.treatment  
est store m2
 
ologit mandate i.treatment##i.republican  
est store m3
ologit mandate i.treatment##i.republican age white female college income  
est store m4

esttab m1 using TableA4.csv, replace nogaps ///
    title( Table A4.) b(3) se(3) starlevels(* 0.10 ** 0.05 *** 0.01 ) 

esttab m2 m3 m4 using TableA5.csv, replace nogaps ///
    title( Table A5.) b(3) se(3) starlevels(* 0.10 ** 0.05 *** 0.01 ) 
	

